package base;
import java.util.HashMap;
import values.Value;


public class Environment {

	public HashMap<String, Value> memory;	
	
	public Environment() {
		memory = new HashMap<String, Value>();
	}
		
	public Environment(HashMap<String, Value> map) {
		this.memory = map;
	}

	public Environment clone() {
		return new Environment((HashMap<String, Value>) (this.memory.clone()));
	}
	
	public void add(Identifier key) {
		memory.put(key.getName(), null);
	}
	
	public void update(Identifier key, Value value) {
		memory.put(key.getName(), value);
	}
	
	public void remove(Identifier key) {
		memory.remove(key.getName());
	}
	
	public boolean contains(Identifier key) {
		return memory.containsKey(key.getName());
	}
	
	public Value getValue(Identifier key) {
		return memory.get(key.getName());
	}
}
